package com.akoj.model.domain.enums;

/**
 * 队伍状态枚举
 */
public enum TeamStatus {

    PUBLIC(0, "公开"),

    PRIVATE(1, "私有"),

    SECRET(2, "加密");

    /**
     * 队伍状态码
     */
    private final int code;

    /**
     * 队伍状态信息
     */
    private final String message;

    TeamStatus(int code, String message){
        this.code = code;
        this.message = message;
    }

    //根据状态码获取状态值
    public static TeamStatus getValueByCode(int code){
        if(code < 0 || code > 2){
            return null;
        }
        for(TeamStatus teamStatus : TeamStatus.values()){
            if(teamStatus.code == code){
                return teamStatus;
            }
        }
        return null;
    }

    public int getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }
}
